@use '@angular/material' as mat;

@mixin card-color($theme) {
  $config: mat.m2-get-color-config($theme);
  $foreground: map-get($config, foreground);
  $background: map-get($config, background);
  $primary: map-get($config, primary);
  $accent: map-get($config, accent);
  $warn: map-get($config, warn);
  $text-color: mat.m2-get-color-from-palette($foreground, text, 0.75);
  $bg-color: mat.m2-get-color-from-palette($background, card);
  .mat-mdc-card {
    color: inherit;
    background-color: $bg-color;
    &:hover {
      cursor: pointer;
      background-color: mat.m2-get-color-from-palette(
        $background,
        background,
        0.85
      );
    }
    .meta {
      .badge {
        background-color: mat.m2-get-color-from-palette($primary, 400, 0.8);
        color: mat.m2-get-color-from-palette($primary, default-contrast);
      }
    }
  }
  .mat-mdc-card-title {
    a {
      color: $text-color;
      &:hover {
        color: mat.m2-get-color-from-palette($primary);
      }
    }
  }
  .mat-mdc-card-subtitle {
    color: inherit;
  }

  .mat-mdc-card-subtitle,
  .card-body {
    color: mat.m2-get-color-from-palette($foreground, text, 0.6);
  }

  .card-1v1 {
    @include mat.elevation(
      4,
      mat.m2-get-color-from-palette($foreground, text),
      0.1
    );
    background-color: $bg-color;
    a {
      color: $text-color;
      &:hover {
        color: mat.m2-get-color-from-palette($primary);
      }
      &.mat-primary {
        &:hover {
          color: mat.m2-get-color-from-palette($primary, default-contrast);
        }
      }
    }
    .author {
      color: $bg-color;
    }
  }

  .card-1-v2 {
    color: mat.m2-get-color-from-palette($primary, default-contrast);
    a {
      color: mat.m2-get-color-from-palette($primary, default-contrast);
    }
  }

  .card-1-v3 {
    .viewport {
      @include scrollbar(
        mat.m2-get-color-from-palette($foreground, divider, 0.2)
      );
    }
    .item {
      @include mat.elevation(4, #000, 0.35);
      background-color: mat.m2-get-color-from-palette($background, card, 0.85);

      .media {
        img {
          box-shadow: 0 4px 10px 1px rgb(0 0 0 / 7%);
        }
      }
    }
    .selected {
      &:after,
      &:before {
        background: mat.m2-get-color-from-palette($primary);
      }
    }
  }

  .law-card {
    .mat-mdc-card {
      overflow: hidden;
      border-radius: 12px;
      box-shadow: 0 6px 16px 0 rgb(0 0 0 / 10%);
    }
  }

  .card-1-v4 {
    .left {
      img {
        @include mat.elevation(
          4,
          mat.m2-get-color-from-palette($foreground, text),
          0.1
        );
      }
    }
    .mat-icon {
      color: mat.m2-get-color-from-palette($warn, text);
    }
    .title {
      color: mat.m2-get-color-from-palette($foreground, text, 0.75);
    }

    .inner {
      @include mat.elevation(
        4,
        mat.m2-get-color-from-palette($foreground, text),
        0.1
      );
      color: mat.m2-get-color-from-palette($foreground, text, 0.5);
      background-color: mat.m2-get-color-from-palette($background, card);
    }
  }

  .card-1v5 {
    @include mat.elevation(
      4,
      mat.m2-get-color-from-palette($foreground, text),
      0.1
    );
    background-color: mat.m2-get-color-from-palette($background, card);
    .more {
      color: mat.m2-get-color-from-palette($primary);
      .mat-icon {
        color: inherit;
      }
    }
  }

  .card-1v6 {
    @include mat.elevation(
      4,
      mat.m2-get-color-from-palette($foreground, text),
      0.1
    );
    background-color: mat.m2-get-color-from-palette($primary, 0.07);
    border-bottom: 3px solid
      mat.m2-get-color-from-palette($foreground, divider, 0.2);
    &:hover {
      border-color: mat.m2-get-color-from-palette($primary);
      background-color: mat.m2-get-color-from-palette(
        $background,
        card
      ) !important;
      @include mat.elevation(
        5,
        mat.m2-get-color-from-palette($foreground, divider),
        0.7
      );
      .title {
        color: mat.m2-get-color-from-palette($primary);
      }
    }
  }
}
